<%--
  Created by IntelliJ IDEA.
  User: 10330
  Date: 2021/7/13
  Time: 14:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/pages/common/header.jsp"%>

<script>
    $(document).ready(function(){
        $("#${param.action}Row").attr('class','list-group-item active');
        $("#${param.action}").show();
    });
</script>

<div class="col-md-2">
    <div class="row">
        <ul  class="list-group"  id="left_cate">
            <a id="allOrderRow" href="${pageContext.request.contextPath}/orders?action=getAllOrder" class="list-group-item">全部订单</a>
            <a href="#" class="list-group-item">待付款订单</a>
            <a href="#" class="list-group-item">交易成功订单</a>
        </ul>
    </div>
</div>

<div id="orderPlace" class="col-md-10" hidden>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-4">
                    </div>
                    <div class="col-md-8">
                        <div class="cart py-container">

                            <!--主内容-->
                            <div style="width:100%; height:550px; ">
                                <div style="margin:90px 0 160px 0">

                                    <img src="${pageContext.request.contextPath}/images/pay.png" style="width:248px; height:248px;" >　
                                    <h3>恭喜您，提交订单成功！</h3>
                                    <p style="margin:40px 10px 0 0">● 支付方式：货到付款</p>
                                    <p style="margin:40px 10px 0 0">● 支付金额：￥${requestScope.priceSum}元</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="allOrder" class="col-md-10" hidden>
    <c:forEach items="${requestScope.orderList}" var="order" varStatus="status">
        <div class="col-md-12" style="font-weight: bold;">
            ${status.count} 订单状态:<c:if test="${order.order_status == 1}">未付款</c:if><c:if test="${order.order_status == 2}">已付款</c:if><c:if test="${order.order_status == 3}">已取消</c:if>   收货地址:${order.order_address}
        </div>


        <table class="table table-striped" id="cart_tab">
            <thead>
            <tr>
                <td>商品图片</td>
                <td>商品名称</td>
                <td>商品单价</td>
                <td>数量</td>
                <td>小计</td>
            </tr>
            </thead>
            <tbody id="cart_tbody">

            <c:set var="priceSum" value="${0}"/>
            <c:forEach items="${requestScope.orderDetailList.get(status.index)}" var="orderDetail">
<%--                <tr id="${cartGoods.value.goods_id}goods">--%>
                <tr>
                    <td><img style="height: 50px" src="${pageContext.request.contextPath}${orderDetail.odetail_pic}"></td>
                    <td>${orderDetail.odetail_name}</td>
                    <td>${orderDetail.odetail_price}</td>
                    <td><input type="text" name="goodsSales" value="${orderDetail.odetail_num}" size="5" readonly></td>
                    <td>${orderDetail.odetail_price * orderDetail.odetail_num}</td>
                </tr>
                <c:set var="priceSum" value="${priceSum + orderDetail.odetail_price * orderDetail.odetail_num}"/>
            </c:forEach>
            </tbody>
        </table>
        <hr>
        <div class="col-md-12" style="text-align: right;font-weight: bold;font-size: larger">
            运费:${requestScope.orderDetailList.get(status.index).size()*12}￥   合计(含运费):${priceSum+requestScope.orderDetailList.get(status.index).size()*12}￥
        </div>
        <br><hr>
    </c:forEach>
</div>

<%@include file="/pages/common/footer.jsp"%>
